package com.wbs.controller;

import com.wbs.resutil.PageBean;
import com.wbs.resutil.PageResult;
import com.wbs.resutil.Result;
import com.wbs.resutil.ResultEnums;
import com.wbs.service.BrandService;
import com.wbs.vo.BrandVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.rsa.crypto.RsaAlgorithm;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: 芝梦
 * @Description: 品牌管理控制层
 * @DateTime: 2024/1/23 14:57
 */
@RequestMapping("brand")
@RestController
public class BrandController {
    @Autowired
    private BrandService brandService;


    //查询所有品牌信息
    @GetMapping("findBrandAll")
    public Result findBrandAll(){
        List<BrandVO> brandVOList = brandService.findBrandAll();
        return Result.SUCCESS().setData(brandVOList);
    }

    /**
     * @RequestBody 用于接收前端发送的json数据
     * @param pageBean
     * @return
     */
    //查询所有品牌信息
    @PostMapping("findBrandPage")
    public Result findBrandPage(@RequestBody PageBean<BrandVO> pageBean){
        PageResult<BrandVO> pageResult = brandService.findBrandPage(pageBean);
        return Result.SUCCESS().setData(pageResult);
    }


}
